# Python 2.6

# import GUI functionality
from gui_functions import *

import os

# initialize the GUI
cdgui = CDGUI()

# start the GUI
# note that the Analyze button has to be moved elsewhere in a latter design
cdgui.start()

# make sure dir exists
try:
    if not os.path.exists(os.path.expanduser("~/.cdi-data")):
        os.makedirs(os.path.expanduser("~/.cdi-data"))
        
    os.chdir(os.path.expanduser("~/.cdi-data/"))
except OSError:
    if os.path.exists(os.path.expanduser("~/.cdi-data")):
        pass
    else:
        # dir doesn't exist but cannot be created either!
        print "Ew! Directory ~/.cdi-data exists but cannot be created?"

#cdgui.ocropus([cdgui.db.currentpaths[0]])

cdgui.ocropi(cdgui.db.currentpaths)

cdgui.gocr("Royksopp_-_Melody_AM.jpg")
#cdgui.gocr("Trio_Mediaeval_-_Folk_Songs.jpg")
#cdgui.gocr("Marcel_Dupre_-_Organ_Works.jpg")


# print the files the user chose
#print cdgui.db.currentpaths

# do stuff with the files here (like OCR)


# for Thomas:
# functions.audioscrobbler()